#include "title.h"
#include "ui_title.h"
#include <QFile>
#include <QDebug>

Title::Title(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Title)
{
    ui->setupUi(this);
    ui->btnmin->setText("-");
    ui->btnmax->setText("□");
    ui->btnclose->setText("×");

    // 使用封装后的 CSS 加载器
    m_styleSet.setStyle(":/css/FrameCss.css");

    connect(ui->btnmax,&QAbstractButton::clicked,this,[=](){
        if(parentWidget()->isMaximized()){
            ui->btnmax->setText("□");
            parentWidget()->showNormal();
        }else{
            parentWidget()->showMaximized();
            ui->btnmax->setText("⿻");
        }

    });
    connect(ui->btnmin,&QAbstractButton::clicked,this,[=](){
        parentWidget()->showMinimized();
    });
    connect(ui->btnclose,&QAbstractButton::clicked,this,[=](){
        parentWidget()->close();
    });
}

Title::~Title()
{
    delete ui;
}
